package main

import (
	"fmt"
	"log"
	"time"
)

func main() {
	ch := make(chan string)
	go SetData(ch)
	go GetData(ch)
	time.Sleep(5 * time.Second)
}

func SetData(ch chan string) {
	for i := 0; i < 10; i++ {
		data := fmt.Sprintf("Hello_%d", i)
		ch <- data
		log.Println("set data success. data =", data)
	}
}

func GetData(ch chan string) {
	for true {
		data := <- ch
		log.Println("GET data success. data =", data)
	}
}
